Skip to content

Instantly share code, notes, and snippets.

@fduran
fduran / Linux Bash generate a number of files of random sizes in a range
Last active May 21, 2024 12:42
Linux Bash generate a number of files of random sizes in a range
#!/bin/bash
# generate a number of files with random sizes in a range
min=1 # min size (MB)
max=10 # max size (MB)
nofiles=20 # number of files
for i in `eval echo {1..$nofiles}`
do
dd bs=1M count=$(($RANDOM%max + $min)) if=/dev/urandom of=./files/file$i
Readme: In the following pseudo code, [] indicates a subroutine.
Sometimes I choose to write the subroutine inline under the [] in order to maintain context.
One important fact about the way rollbacks are handled here is that we are storing state for every frame.
In any real implementation you only need to store one game state at a time. Storing a game
state for every frame allows us to only rollback to the first frame where the predicted inputs don't match the true ones.
==Constants==
MAX_ROLLBACK_FRAMES := Any Positive Integer # Specifies the maximum number of frames that can be resimulated
FRAME_ADVANTAGE_LIMIT := Any Positive Integer # Specifies the number of frames the local client can progress ahead of the remote client before time synchronizing.
@dfinke
dfinke / Try-CompositePattern.ps1
Last active May 21, 2024 12:42
Composite Pattern: Simplifies client code by treating individual objects and compositions uniformly, making it easier to work with complex structures
. .\Employee.ps1
$CEO = [Employee]::new("John","CEO", 30000)
$HeadSales = [Employee]::new("Robert","Head Sales", 20000)
$HeadMarketing = [Employee]::new("Michel","Head Marketing", 20000)
$clerk1 = [Employee]::new("Laura","Marketing", 10000)
$clerk2 = [Employee]::new("Bob","Marketing", 10000)
$salesExecutive1 = [Employee]::new("Richard","Sales", 10000)
$salesExecutive2 = [Employee]::new("Rob","Sales", 10000)
@nessus42
nessus42 / destiny-networking.md
Last active May 21, 2024 12:39
How Networking Works in Destiny 1 and How It Will Differ in Destiny 2 (According to Bungie)

(NOTE: This is the original version of my Reddit post. Since I have made a major revision to the post in order to clarify issues that were left somewhat unclear in the original version, and to address some complaints about minor factual errors, I am preserving the original here just so that no one thinks that I'm trying to pull the wool over anyone's eyes. The updated version is available here. It can probably be left unsaid that this parenthetical comment was not in the original post, but I've learned the hard way that unless you spell everything out in explicit detail and accuracy, someone or another will post a complaint.)

TLDR: In Destiny 1, there are three types of servers: mission servers, zone servers, and physics servers. The first two run in Bungie's server cloud, but the physics server runs on a player's console. The physics server runs on a console in order to save mone

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@xero
xero / irc.md
Last active May 21, 2024 12:38
irc cheat sheet

IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
  • Leaves the specified channel.
@CharlyJazz
CharlyJazz / Argentina_Provincias_Ciudades.sql
Last active May 21, 2024 12:37
Argentina Ciudades Provincias Localidades SQL
--
-- Estructura de tabla para la tabla `provincias`
--
DROP TABLE IF EXISTS `provincias`;
CREATE TABLE IF NOT EXISTS `provincias` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`provincia` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
@parmentf
parmentf / GitCommitEmoji.md
Last active May 21, 2024 12:34
Git Commit message Emoji
@DanPuzey
DanPuzey / Log.cs
Last active May 21, 2024 12:34
Unity logging wrapper, for better performance and usage.
using UnityEngine;
namespace Assets.Phunk.Core
{
public static class Log
{
#region Error
public static void ErrorFormat(UnityEngine.Object context, string template, params object[] args)
{
var message = string.Format(template, args);